package com.agino;

import org.nfunk.jep.JEP;

/**
 * @author agino
 * @version 1.0
 * @date 2022/8/1 16:20
 */
public class JEPLearn {

    public static void main(String[] args) {
        String expression = "(a+b)*b-1";
        JEP jep = new JEP();
        //1 设置变量
        jep.addVariable("a", 1);
        jep.addVariable("b", 2);
        //2 计算表达式
        jep.parseExpression(expression);
        //3 获取表达式的值
        double result = jep.getValue();
        System.out.println(result);

    }
}
